
package com.hlkj.pay.app.merchant.ext.impl.lakala.ext;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import com.fasterxml.jackson.core.type.TypeReference;
import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.framework.common.util.json.JsonUtils;
import com.hlkj.framework.extension.annotation.Extension;
import com.hlkj.pay.app.merchant.ext.dto.order.ChannelPayOrderContext;
import com.hlkj.pay.app.merchant.ext.dto.order.ChannelPayOrderQueryContext;
import com.hlkj.pay.app.merchant.ext.dto.order.ChannelRefundPayOrderContext;
import com.hlkj.pay.app.merchant.ext.impl.lakala.LakalaScenePayOrderExtPt;
import com.hlkj.pay.app.merchant.ext.impl.lakala.constant.LakalaConstant;
import com.hlkj.pay.app.merchant.ext.impl.lakala.constant.LakalaExtConstant;
import com.hlkj.pay.app.merchant.ext.impl.lakala.dto.LakalaAppChannelParams;
import com.hlkj.pay.app.merchant.ext.impl.lakala.dto.LakalaConfig;
import com.hlkj.pay.app.merchant.ext.impl.lakala.dto.req.LakalaH5PayReq;
import com.hlkj.pay.app.merchant.ext.impl.lakala.dto.resp.*;
import com.hlkj.pay.app.merchant.ext.impl.lakala.utils.LKLSDK;
import com.hlkj.pay.enums.PayOrderEnums;
import com.hlkj.pay.infrastructure.model.merchant.MerchantAppChannelDO;
import com.hlkj.pay.infrastructure.model.order.PayOrderDO;
import com.hlkj.pay.infrastructure.model.order.RefundOrderDO;
import com.hlkj.pay.util.DateUtils;
import com.hlkj.pay.util.MerchantUtils;
import com.lkl.laop.sdk.exception.SDKException;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 条码支付，商户扫用户二维码收款
 * 
 * @author HlpayTeam
 * @date 2024/11/18 13:08
 */
@Slf4j
@Repository
@RequiredArgsConstructor
@Extension(bizId = LakalaExtConstant.H5)
public class LakalaH5PayOrderExtPt extends LakalaSceneCommonPayOrder implements LakalaScenePayOrderExtPt {

    @Override
    public void submitChannelPayOrder(ChannelPayOrderContext channelPayOrderContext) {
        // 配置转换
        LakalaConfig lakalaConfig = lakalaConfig(channelPayOrderContext.getProviderChannelConfigDO(), channelPayOrderContext.isTest());
        PayOrderDO payOrderDO = channelPayOrderContext.getPayOrderDO();
        MerchantAppChannelDO merchantAppChannelDO = channelPayOrderContext.getMerchantAppChannelDO();
        LakalaAppChannelParams lakalaAppChannelParams = lakalaAppChannelParams(merchantAppChannelDO);
        try {
            String openapiDomain = openapiDomain(channelPayOrderContext.isTest());
            LKLSDK.init(lakalaConfig, openapiDomain);
            Map<String, Object> params = new HashMap<>();
            params.put("out_order_no", payOrderDO.getPayOrderNo());
            params.put("merchant_no", lakalaAppChannelParams.getMerCupNo());
            // params.put("vpos_id", lakalaAppChannelParams.getTermId());
            params.put("total_amount", MerchantUtils.YuanToFen(payOrderDO.getAmount()).toString());
            params.put("order_efficient_time", DateUtils.dateToString(payOrderDO.getExpiredTime(), "yyyyMMddHHmmss"));
            params.put("notify_url", channelPayOrderContext.getNotifyUrl());
            params.put("support_cancel", 1);
            params.put("support_refund", 1);
            params.put("order_info", payOrderDO.getSubject());
            params.put("counter_param", "{\"pay_mode\" : \"WECHAT\"} ");
            LakalaH5PayReq lakalaPayReq = new LakalaH5PayReq();
            lakalaPayReq.setReq_time(reqTime());
            lakalaPayReq.setReq_data(params);
            String body = JsonUtils.toJsonString(lakalaPayReq);
            log.info("拉卡拉H5支付请求参数:{}", body);
            String response = LKLSDK.httpPost(openapiDomain(channelPayOrderContext.isTest()) + LakalaConstant.MERCHANT_PAY_ORDER_H5, body, lakalaConfig.getAppId());
            log.info("拉卡拉H5支付返回参数:{}", JsonUtils.toJsonString(response));
            LakalaPayRes<LakalaPayOrderH5SubmitRes> lakalaRes = JsonUtils.parseObject(response, new TypeReference<LakalaPayRes<LakalaPayOrderH5SubmitRes>>() {
            });

            LakalaPayOrderH5SubmitRes respData = lakalaRes.getResp_data();
            if (LakalaConstant.H5_SUCCESS_CODE.equals(lakalaRes.getCode())) {
                channelPayOrderContext.setPayDataType("pay_url");
                channelPayOrderContext.setPayInfo(respData.getCounter_url());
                channelPayOrderContext.setChannelOrderNo(respData.getPay_order_no());
            }
            else {
                channelPayOrderContext.setProcessStatus(Boolean.FALSE);
                if (StringUtils.hasText(lakalaRes.getMsg())) {
                    channelPayOrderContext.setRemark(lakalaRes.getMsg());
                }
                else {
                    channelPayOrderContext.setRemark("拉卡拉提交H5支付查询返回错误信息为空,错误码为:" + lakalaRes.getCode());
                }
            }
        }
        catch (SDKException e) {
            e.printStackTrace();
            log.error("拉卡拉提交H5支付请求失败 lakalaConfig:{},message:{}", JsonUtils.toJsonString(lakalaConfig), e.getMessage(), e);
            channelPayOrderContext.setRemark("拉卡拉提交H5支付请求失败,失败信息" + e.getMessage());
            channelPayOrderContext.setProcessStatus(Boolean.FALSE);
            // channelMerchantAccessQueryContext.setAccessStatus(MerchantEnum.CHANNEL_CONFIG_STATUS.APPROVE_REFUSE);
        }
        catch (Exception e) {
            e.printStackTrace();
            log.error("拉卡拉提交H5支付请求失败 message:{}", e.getMessage(), e);
            channelPayOrderContext.setRemark("拉卡拉提交H5支付请求失败,失败信息" + e.getMessage());
            channelPayOrderContext.setProcessStatus(Boolean.FALSE);
            // channelMerchantAccessQueryContext.setAccessStatus(MerchantEnum.CHANNEL_CONFIG_STATUS.APPROVE_REFUSE);
        }
    }

    @Override
    public void queryChannelPayOrder(ChannelPayOrderQueryContext channelPayOrderQueryContext) {
        // 配置转换
        LakalaConfig lakalaConfig = lakalaConfig(channelPayOrderQueryContext.getProviderChannelConfigDO(), channelPayOrderQueryContext.isTest());
        PayOrderDO payOrderDO = channelPayOrderQueryContext.getPayOrderDO();
        MerchantAppChannelDO merchantAppChannelDO = channelPayOrderQueryContext.getMerchantAppChannelDO();
        LakalaAppChannelParams lakalaAppChannelParams = lakalaAppChannelParams(merchantAppChannelDO);
        try {
            String openapiDomain = openapiDomain(channelPayOrderQueryContext.isTest());
            LKLSDK.init(lakalaConfig, openapiDomain);
            Map<String, Object> params = new HashMap<>();
            params.put("merchant_no", lakalaAppChannelParams.getMerCupNo());
            params.put("out_order_no", payOrderDO.getPayOrderNo());
            LakalaH5PayReq lakalaPayReq = new LakalaH5PayReq();
            lakalaPayReq.setReq_time(reqTime());
            lakalaPayReq.setReq_data(params);
            String body = JsonUtils.toJsonString(lakalaPayReq);
            log.info("拉卡拉H5订单查询请求参数:{}", body);
            String response = LKLSDK.httpPost(openapiDomain(channelPayOrderQueryContext.isTest()) + LakalaConstant.MERCHANT_PAY_ORDER_QUERY_H5, body, lakalaConfig.getAppId());
            log.info("拉卡拉H5订单查询返回参数:{}", JsonUtils.toJsonString(response));
            LakalaPayRes<LakalaPayOrderH5Res> lakalaRes = JsonUtils.parseObject(response, new TypeReference<LakalaPayRes<LakalaPayOrderH5Res>>() {
            });
            if (LakalaConstant.H5_SUCCESS_CODE.equals(lakalaRes.getCode())) {
                LakalaPayOrderH5Res respData = lakalaRes.getResp_data();
                PayOrderDO updartePayOrderDO = new PayOrderDO();
                channelPayOrderQueryContext.setUpdartePayOrderDO(updartePayOrderDO);
                // 0:待支付 1:支付中 2:支付成功 3:支付失败 4:已过期 5:已取消 6:部分退款或者全部退款 7:订单已关闭枚举
                switch (respData.getOrder_status()) {
                    case "0":
                    case "1":
                        updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.PAYING.getCode());
                        updartePayOrderDO.setBankMsg("");
                        break;
                    case "2":
                    case "6":
                        updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.SUCCESS.getCode());
                        updartePayOrderDO.setBankMsg("");
                        break;
                    case "3":
                        updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.FAIL.getCode());
                        break;
                    case "5":
                        updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.CANCEL.getCode());
                        break;
                    case "4":
                    case "7":
                        updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.CLOSE.getCode());
                        break;

                }
                List<LakalaPayOrderH5Res.OrderTradeInfoListBean> orderTradeInfoList = respData.getOrder_trade_info_list();
                if (CollectionUtils.isEmpty(orderTradeInfoList)) {
                    return;
                }
                LakalaPayOrderH5Res.OrderTradeInfoListBean orderTradeInfoListBean = orderTradeInfoList.get(0);
                // 成功的订单
                // 返回状态 S:成功 F:失败 C:被冲正 U:预记状态 X:发送失败 T: 发送超时 P: 处理中
                List<LakalaPayOrderH5Res.OrderTradeInfoListBean> collect = orderTradeInfoList.stream()
                        .filter(orderTradeInfoListBean1 -> "S".equals(orderTradeInfoListBean1.getTrade_status())).collect(Collectors.toList());
                if (!CollectionUtils.isEmpty(collect)) {
                    orderTradeInfoListBean = collect.get(0);
                }
                if (StringUtils.hasText(orderTradeInfoListBean.getTrade_time())) {
                    try {
                        updartePayOrderDO.setSuccessTime(DateUtils.shanghaiDate(orderTradeInfoListBean.getTrade_time()));
                    }
                    catch (Exception e) {
                        log.error("拉卡拉H5订单查询返回 时间格式化错误 dateTime:{},message:{}", orderTradeInfoListBean.getTrade_time(), e.getMessage());
                    }
                }
                updartePayOrderDO.setChannelOrderNo(orderTradeInfoListBean.getTrade_no());
                updartePayOrderDO.setInsOrderNo(orderTradeInfoListBean.getAcc_trade_no());
                updartePayOrderDO.setChannelOrderId(orderTradeInfoListBean.getLog_No());
                if (orderTradeInfoListBean.getPayer_amount() != null) {
                    updartePayOrderDO.setPayAmount(MerchantUtils.fenToYuan(orderTradeInfoListBean.getPayer_amount()));
                }
                else {
                    updartePayOrderDO.setPayAmount(payOrderDO.getAmount());
                }
                if (StringUtils.hasText(orderTradeInfoListBean.getUser_id1())) {
                    updartePayOrderDO.setUserId(orderTradeInfoListBean.getUser_id1());
                }
                else {
                    updartePayOrderDO.setUserId(orderTradeInfoListBean.getUser_id2());
                }

            }
            else {
                String respDesc = lakalaRes.getMsg();
                channelPayOrderQueryContext.setProcessStatus(Boolean.FALSE);
                if (StringUtils.hasText(respDesc)) {
                    channelPayOrderQueryContext.setRemark(respDesc);
                }
                else {
                    channelPayOrderQueryContext.setRemark("拉卡拉提交支付订单查询返回错误信息为空,错误码为:" + lakalaRes.getMsg());
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            log.error("拉卡拉提交条码支付请求失败 message:{}", e.getMessage(), e);
            channelPayOrderQueryContext.setRemark("拉卡拉提交条码支付请求失败,失败信息" + e.getMessage());
            channelPayOrderQueryContext.setProcessStatus(Boolean.FALSE);
            // channelMerchantAccessQueryContext.setAccessStatus(MerchantEnum.CHANNEL_CONFIG_STATUS.APPROVE_REFUSE);
        }
    }

    @Override
    public void closeChannelPayOrder(ChannelPayOrderQueryContext channelPayOrderQueryContext) {
        // 配置转换
        LakalaConfig lakalaConfig = lakalaConfig(channelPayOrderQueryContext.getProviderChannelConfigDO(), channelPayOrderQueryContext.isTest());
        PayOrderDO payOrderDO = channelPayOrderQueryContext.getPayOrderDO();
        MerchantAppChannelDO merchantAppChannelDO = channelPayOrderQueryContext.getMerchantAppChannelDO();
        LakalaAppChannelParams lakalaAppChannelParams = lakalaAppChannelParams(merchantAppChannelDO);
        try {
            String openapiDomain = openapiDomain(channelPayOrderQueryContext.isTest());
            LKLSDK.init(lakalaConfig, openapiDomain);
            Map<String, Object> params = new HashMap<>();
            params.put("merchant_no", lakalaAppChannelParams.getMerCupNo());
            params.put("out_order_no", payOrderDO.getPayOrderNo());
            LakalaH5PayReq lakalaPayReq = new LakalaH5PayReq();
            lakalaPayReq.setReq_time(reqTime());
            lakalaPayReq.setReq_data(params);
            String body = JsonUtils.toJsonString(lakalaPayReq);
            log.info("拉卡拉关闭H5订单请求参数:{}", JsonUtils.toJsonString(body));
            String response = LKLSDK.httpPost(openapiDomain(channelPayOrderQueryContext.isTest()) + LakalaConstant.MERCHANT_PAY_ORDER_CLOSE_H5, body, lakalaConfig.getAppId());
            log.info("拉卡拉关闭H5订单返回参数:{}", JsonUtils.toJsonString(response));
            LakalaPayRes<LakalaPayOrderRes> lakalaRes = JsonUtils.parseObject(response, new TypeReference<LakalaPayRes<LakalaPayOrderRes>>() {
            });
            if (LakalaConstant.H5_SUCCESS_CODE.equals(lakalaRes.getCode())) {
                PayOrderDO updartePayOrderDO = new PayOrderDO();
                updartePayOrderDO.setState(PayOrderEnums.PAY_ORDER_STATUS.CLOSE.getCode());
                channelPayOrderQueryContext.setUpdartePayOrderDO(updartePayOrderDO);
            }
            else {
                String respDesc = lakalaRes.getMsg();
                channelPayOrderQueryContext.setProcessStatus(Boolean.FALSE);
                if (StringUtils.hasText(respDesc)) {
                    channelPayOrderQueryContext.setRemark(respDesc);
                }
                else {
                    channelPayOrderQueryContext.setRemark("拉卡拉订单关闭返回错误信息为空,错误码为:" + lakalaRes.getCode());
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            log.error("拉卡拉H5关闭支付订单请求失败 message:{}", e.getMessage(), e);
            channelPayOrderQueryContext.setRemark("拉卡拉H5关闭支付订单请求失败,失败信息" + e.getMessage());
            channelPayOrderQueryContext.setProcessStatus(Boolean.FALSE);
        }
    }

    @Override
    public void queryChannelClosePayOrder(ChannelPayOrderQueryContext channelPayOrderQueryContext) {
        commonQueryChannelClosePayOrder(channelPayOrderQueryContext);
    }

    @Override
    public void refundChannelPayOrder(ChannelRefundPayOrderContext channelRefundPayOrderContext) {
        // 配置转换
        LakalaConfig lakalaConfig = lakalaConfig(channelRefundPayOrderContext.getProviderChannelConfigDO(), channelRefundPayOrderContext.isTest());
        PayOrderDO payOrderDO = channelRefundPayOrderContext.getPayOrderDO();
        RefundOrderDO refundOrderDO = channelRefundPayOrderContext.getRefundOrderDO();
        MerchantAppChannelDO merchantAppChannelDO = channelRefundPayOrderContext.getMerchantAppChannelDO();
        LakalaAppChannelParams lakalaAppChannelParams = lakalaAppChannelParams(merchantAppChannelDO);
        try {
            String openapiDomain = openapiDomain(channelRefundPayOrderContext.isTest());
            LKLSDK.init(lakalaConfig, openapiDomain);
            Map<String, Object> params = new HashMap<>();
            params.put("merchant_no", lakalaAppChannelParams.getMerCupNo());
            params.put("term_no", lakalaAppChannelParams.getTermId());
            params.put("out_trade_no", refundOrderDO.getRefundOrderNo());
            params.put("refund_amount", MerchantUtils.YuanToFen(refundOrderDO.getRefundAmount()));
            params.put("refund_reason", refundOrderDO.getRefundReason());
            params.put("origin_out_trade_no", payOrderDO.getPayOrderNo());
            params.put("origin_trade_no", payOrderDO.getChannelOrderNo());
            // params.put("origin_log_no", payOrderDO.getChannelOrderId());
            Map<String, Object> location_info = new HashMap<>();
            location_info.put("request_ip", payOrderDO.getClientIp());
            params.put("location_info", location_info);
            params.put("notify_url", channelRefundPayOrderContext.getNotifyUrl());
            LakalaH5PayReq lakalaPayReq = new LakalaH5PayReq();
            lakalaPayReq.setReq_time(reqTime());
            lakalaPayReq.setReq_data(params);
            lakalaPayReq.setVersion("3");
            String body = JsonUtils.toJsonString(lakalaPayReq);
            log.info("拉卡拉H5订单退款请求参数:{}", JsonUtils.toJsonString(body));
            String response = LKLSDK.httpPost(openapiDomain(channelRefundPayOrderContext.isTest()) + LakalaConstant.MERCHANT_PAY_ORDER_REFUND_H5, body, lakalaConfig.getAppId());
            log.info("拉卡拉H5订单退款返回参数:{}", JsonUtils.toJsonString(response));
            LakalaPayRes<LakalaRefundOrderRes> lakalaRes = JsonUtils.parseObject(response, new TypeReference<LakalaPayRes<LakalaRefundOrderRes>>() {
            });
            if (LakalaConstant.H5_SUCCESS_CODE.equals(lakalaRes.getCode())) {
                LakalaRefundOrderRes respData = lakalaRes.getResp_data();
                RefundOrderDO updateRefundOrderDO = new RefundOrderDO();
                if (StringUtils.hasText(respData.getPayer_amount())) {
                    updateRefundOrderDO.setActualRefundAmount(MerchantUtils.fenToYuan(respData.getPayer_amount()));
                }
                updateRefundOrderDO.setRefundStatus(PayOrderEnums.REFUND_STATUS.REFUNDING.getCode());

                channelRefundPayOrderContext.setUpdateRefundOrderDO(updateRefundOrderDO);
            }
            else {
                String respDesc = lakalaRes.getMsg();
                channelRefundPayOrderContext.setProcessStatus(Boolean.FALSE);
                if (StringUtils.hasText(respDesc)) {
                    channelRefundPayOrderContext.setRemark(respDesc);
                }
                else {
                    channelRefundPayOrderContext.setRemark("拉卡拉提交退款订单返回错误信息为空,错误码为:" + lakalaRes.getMsg());
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            log.error("拉卡拉提交退款订单请求失败 message:{}", e.getMessage(), e);
            channelRefundPayOrderContext.setRemark("拉卡拉提交退款订单请求失败,失败信息" + e.getMessage());
            channelRefundPayOrderContext.setProcessStatus(Boolean.FALSE);
        }
    }

    @Override
    public void queryRefundChannelPayOrder(ChannelRefundPayOrderContext channelRefundPayOrderContext) {
        // 配置转换
        LakalaConfig lakalaConfig = lakalaConfig(channelRefundPayOrderContext.getProviderChannelConfigDO(), channelRefundPayOrderContext.isTest());
        PayOrderDO payOrderDO = channelRefundPayOrderContext.getPayOrderDO();
        RefundOrderDO refundOrderDO = channelRefundPayOrderContext.getRefundOrderDO();
        MerchantAppChannelDO merchantAppChannelDO = channelRefundPayOrderContext.getMerchantAppChannelDO();
        LakalaAppChannelParams lakalaAppChannelParams = lakalaAppChannelParams(merchantAppChannelDO);
        try {
            String openapiDomain = openapiDomain(channelRefundPayOrderContext.isTest());
            LKLSDK.init(lakalaConfig, openapiDomain);
            Map<String, Object> params = new HashMap<>();
            params.put("merchant_no", lakalaAppChannelParams.getMerCupNo());
            params.put("term_no", lakalaAppChannelParams.getTermId());
            params.put("out_trade_no", refundOrderDO.getRefundOrderNo());
            LakalaH5PayReq lakalaPayReq = new LakalaH5PayReq();
            lakalaPayReq.setReq_time(reqTime());
            lakalaPayReq.setReq_data(params);
            lakalaPayReq.setVersion("3");
            String body = JsonUtils.toJsonString(lakalaPayReq);
            log.info("拉卡拉H5退款订单查询请求参数:{}", body);
            String response = LKLSDK.httpPost(openapiDomain(channelRefundPayOrderContext.isTest()) + LakalaConstant.MERCHANT_PAY_ORDER_REFUND_QUERY_H5, body, lakalaConfig.getAppId());
            log.info("拉卡拉H5退款订单查询返回参数:{}", JsonUtils.toJsonString(response));
            LakalaPayRes<LakalaRefundOrderRes> lakalaRes = JsonUtils.parseObject(response, new TypeReference<LakalaPayRes<LakalaRefundOrderRes>>() {
            });
            if (LakalaConstant.H5_SUCCESS_CODE.equals(lakalaRes.getCode())) {
                LakalaRefundOrderRes respData = lakalaRes.getResp_data();
                RefundOrderDO updateRefundOrderDO = new RefundOrderDO();
                switch (respData.getTrade_state()) {
                    case "SUCCESS":
                        updateRefundOrderDO.setRefundStatus(PayOrderEnums.REFUND_STATUS.REFUND.getCode());
                        break;
                    case "FAIL":
                    case "EXCEPTION":
                        updateRefundOrderDO.setRefundStatus(PayOrderEnums.REFUND_STATUS.FAIL.getCode());
                        break;
                    default:
                        updateRefundOrderDO.setRefundStatus(PayOrderEnums.REFUND_STATUS.REFUNDING.getCode());
                }
                if (StringUtils.hasText(respData.getPayer_amount())) {
                    updateRefundOrderDO.setActualRefundAmount(MerchantUtils.fenToYuan(respData.getPayer_amount()));
                }
                updateRefundOrderDO.setBankMsg(respData.getChannel_ret_desc());
                channelRefundPayOrderContext.setUpdateRefundOrderDO(updateRefundOrderDO);
            }
            else {
                String respDesc = lakalaRes.getMsg();
                channelRefundPayOrderContext.setProcessStatus(Boolean.FALSE);
                if (StringUtils.hasText(respDesc)) {
                    channelRefundPayOrderContext.setRemark(respDesc);
                }
                else {
                    channelRefundPayOrderContext.setRemark("拉卡拉H5退款订单查询返回错误信息为空,错误码为:" + lakalaRes.getMsg());
                }
            }
        }
        catch (

        Exception e) {
            e.printStackTrace();
            log.error("拉卡拉H5退款订单查询请求失败 message:{}", e.getMessage(), e);
            channelRefundPayOrderContext.setRemark("拉卡拉提交条码支付请求失败,失败信息" + e.getMessage());
            channelRefundPayOrderContext.setProcessStatus(Boolean.FALSE);
            // channelMerchantAccessQueryContext.setAccessStatus(MerchantEnum.CHANNEL_CONFIG_STATUS.APPROVE_REFUSE);
        }
    }

    @Override
    public boolean refundApply(ChannelRefundPayOrderContext channelRefundPayOrderContext) {
        return true;
    }

    @Override
    public CommonResult<String> channelOrderCode(ChannelPayOrderContext channelPayOrderContext) {
        return CommonResult.success();
    }
}
